﻿using KPI.Entity;
using KPI.UIBase;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KPIClient.Views
{
    public class ViewCreateQuestionModel : QuestionInfoModel
    {
        public ViewCreateQuestionModel()
        {
            ListQtType.Add(new IntStringData { Key = ((int)EnumQtType.SingleSelect), Value = "单选题" });
            ListQtType.Add(new IntStringData { Key = ((int)EnumQtType.MutilSelect), Value = "多选题" });
            ListQtType.Add(new IntStringData { Key = ((int)EnumQtType.TrueFalse), Value = "判断题" });
            ListQtType.Add(new IntStringData { Key = ((int)EnumQtType.ShortAnswer), Value = "简答题" });
        }
        private ObservableCollection<IntStringData> _ListQtType = new ObservableCollection<IntStringData>();
        public ObservableCollection<IntStringData> ListQtType { get { return _ListQtType; } set { Set("ListQtType", ref _ListQtType, value); } }

        private IntStringData _SelectedQtType;
        public IntStringData SelectedQtType { get => _SelectedQtType; set => Set("SelectedQtType", ref _SelectedQtType, value); }


        public override void FromData(QuestionBankInfoVO data)
        {
            base.FromData(data);
            SelectedQtType = ListQtType.FirstOrDefault(x => x.Key == data.qtType);
        }
    }
}
